package br.com.crednove.dao;

import br.com.crednove.modelo.Usuario;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DAOUsuario {

    private Conexao conexao;
    
    public DAOUsuario() {
        this.conexao = new Conexao();
    }
    
    public boolean insert(Usuario user){
        PreparedStatement pstm = null;
        //this.conexao.conectar();
        try {
            final String sql = "insert into usuario (user_nome, user_usuario, user_usuario) VALUES (?,?,?)";
            pstm = this.conexao.getConector().prepareStatement(sql);

            pstm.setString(1, user.getNome());
            pstm.setString(2, user.getNome());
            pstm.setString(3, user.getNome());

            pstm.executeUpdate();
            pstm.close();
            return true;

        } catch (SQLException erro) {
            System.out.println(erro);
            return false;
        } finally {
            //this.conexao.desconectar();
        }
    }
    
    
    
     
}
